import tf from 'then-fs'

async function getData() {
    const str1 = await tf.readFile('./10-data.json', 'utf8')
    return JSON.parse(str1)
}

async function delData(id) {
    try {
        const arr = await getData()
        const newArr = arr.filter(ele => id != ele.id)
        tf.writeFile('./10-data.json', JSON.stringify(newArr))
        return '删除成功'
    } catch {
        return ' 删除失败'
    }
}
delData(6)